import { fromJS } from 'immutable';
import { actionType } from './index';
const defaultState = fromJS({
     switchFlag:true,
     totalUsers:[]
});

export default (state = defaultState,action)=>{
    switch (action.type) {
        case actionType.CHANGE_TITLE:
            return state.set('switchFlag',action.value)
        case actionType.ADD_USERS:
            return state.merge({
                'totalUsers':state.get('totalUsers').concat(action.dataUser),
                'switchFlag':true
            })
        default:
          return state;
    }
    
}